# 使用官方 Python 基础镜像
FROM docker.1ms.run/python:3.12-slim

# 设置工作目录
WORKDIR /ws

# 复制依赖文件
COPY requirements_dev.txt .

# 设置环境变量（时区+UTF-8）
ENV TZ=Asia/Shanghai \
    DEBIAN_FRONTEND=noninteractive \
    PYTHONIOENCODING=UTF-8

# 配置系统软件源（基于Debian的镜像）
# RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list && \
#     sed -i 's/security.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list

# 配置 Python pip 源
RUN pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/ && \
    pip config set install.trusted-host mirrors.aliyun.com

# 安装依赖
RUN pip install --no-cache-dir -r requirements_dev.txt

# 复制应用代码
# COPY ./app /ws/app
# COPY ./static /ws/static
# COPY ./.env /ws/.env

# 暴露端口（FastAPI 默认 8000）
EXPOSE 8000

# 启动命令
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]